package StructuralPatterns.Composite;

import java.util.ArrayList;
import java.util.List;

public class University extends OrganizationComponent {

  List<OrganizationComponent> organizationComponentArrayList = new ArrayList<OrganizationComponent>();

  public University(String name, String des) {
    super(name, des);
  }

  @Override
  protected void add(OrganizationComponent organizationComponent) {
    organizationComponentArrayList.add(organizationComponent);
  }

  @Override
  protected void remove(OrganizationComponent organizationComponent) {
    organizationComponentArrayList.remove(organizationComponent);
  }

  @Override
  protected void print() {
    System.out.println("------------" + getName() + "------------");
    for (OrganizationComponent organizationComponent : organizationComponentArrayList) {
      organizationComponent.print();
    }
  }

  @Override
  public String getDes() {
    return super.getDes();
  }

  @Override
  public String getName() {
    return super.getName();
  }
}
